#include "RBTree.h"


void test1()
{
	RBTree<int, int> a;
	srand((unsigned int)time(0));
	int N = 1000000;
	size_t ret1 = clock();
	for (int i = 0; i < N; i++)
	{
		int num = rand() + i;
		a.Insert({ num,num });
	}
	size_t ret2 = clock();

	size_t ret3 = clock();
	for (int i = 0; i < N; i++)
	{
		int num = rand() + i;
		a.Find(num);
	}
	size_t ret4 = clock();

	cout << "insert->time : " << ret2 - ret1 << endl;
	cout << "Find->time : " << ret4 - ret3 << endl;
	cout << "size-> " << a.Size() << endl;
	cout << "height-> " << a.Height() << endl;
	cout << "-> " << a.IsRBTree() << endl;

}

void test2()
{
	int arr[] = { 4,2,6,1,3,5,15,7,16,14 };
	//int arr[] = { 16,3,7,11,9,26,18,14,15 };
	RBTree<int, int> a;
	for (auto e : arr)
	{
		a.Insert({ e,e });
	}
	cout << "height-> :" << a.Height() << endl;
	cout << "size-> :" << a.Size() << endl;
	cout << a.IsRBTree() << endl;
	cout << a.Size() << endl;
	a.InOrder();

}

int main()
{
	test1();
	//test2();



	return 0;
}